/*
 * Copyright (C) 2016 yixun All Rights Reserved.
 * 
 * CodeTypeEnum.java
 */
package com.emm.yixun.common.model.enums;
import java.io.Serializable;
import org.apache.commons.lang.StringUtils;
/**
 * [文件名称]<br>
 * BaseCodeValue.java<br>
 * <br>
 * [文件描述]<br>
 * 基础编码值 pojo bean<br>
 * <br>
 * [修改记录]<br>
 * 2016-11-23 11:15:27 创建<br>

 * @version 1.00
*/
public enum BaseCodeTypeEnum implements Serializable{
		TYPE_ONE("1","获知途径",null),
		TYPE_TWO("2","客户性质",null),
		TYPE_THREE("3","置业动机",null),
		TYPE_FOUR("4","关注重点",null),
		TYPE_FIVE("5","需求楼层",null),
		TYPE_SIX("6","生活服务",null),
		TYPE_SEVEN("7","生活配套",null),
		TYPE_EIGHT("8","希望庭院具备功能",null),
		TYPE_NINE("9","家庭结构",null),
		TYPE_TEN("10","目前居住的物业类型",null),
		TYPE_ELEVEN("11","首次接触方式",null),
		TYPE_TWELVE("12","证件类型",null),
		TYPE_THIRTEEN("13","车驾品牌",null),
		TYPE_FOURTEEN("14","乐于参加的活动类型",null),
		TYPE_FIFTEEN("15","兴趣爱好",null),
		TYPE_SIXTEEN("16","日常信息获知途径",null),
		TYPE_SEVENTEEN("17","目前居住的户型结构",null),
		TYPE_EIGHTEEN("18","学历",null),
		TYPE_NINETEEN("19","从事行业",null),
		TYPE_TWENTY("20","公司性质",null),
		TYPE_TWENTY_ONE("21","联系方式",null),
		TYPE_TWENTY_TWO("22","目前居住/办公的房子属性",null)
		;
		
		private final String no;
		private final String des;
		private final Enum parent;
		
		/**
		 * 私有构造函数
		 * @param code
		 * @param description
		 */
		BaseCodeTypeEnum(String no, String des,Enum parent) {
			this.no = no;
			this.des = des;
			this.parent = parent;
		}

		/**
		 * @return Returns the no.
		 */
		public String getNo() {
			return no;
		}

		/**
		 * @return Returns the des.
		 */
		public String getDes() {
			return des;
		}
		
		/**
		 * @return Returns the parent.
		 */
		public Enum getParent() {
			return parent;
		}

		/**
		 * 通过枚举<code>des</code>获得枚举
		 * 
		 * @param des
		 * @return
		 */
		public static BaseCodeTypeEnum getByDescription(String des) {
			if(StringUtils.isBlank(des)){
				return null;
			}
			for (BaseCodeTypeEnum menum : values()) {
				if (menum.getDes().equals(des)) {
					return menum;
				}
			}
			return null;
		}
		public static BaseCodeTypeEnum getByNo(String no) {
			if(StringUtils.isBlank(no)){
				return null;
			}
			for (BaseCodeTypeEnum menum : values()) {
				if (menum.getNo().equals(no)) {
					return menum;
				}
			}
			return null;
		}
}
